<?php
namespace app\admin\validate;

use think\Validate;

class Link extends Validate
{
    protected $rule = [
        'name' =>  'require|max:60|unique:link',
        'desc' =>  'require|max:150',
        'url'  =>  'require|max:100',
    //  'type' =>  'require|in:0,1',
    ];
    
    protected $message  =   [
        'name.require' => '友情链接名称不能为空',
        'name.max'     => '友情链接名称最多不能超过60个字符',
        'name.unique'  => '友情链接名称不允许重复',
        'desc.require' => '友情链接描述不能为空',
        'desc.max'     => '友情链接描述最多不能超过150个字符',
        'url.require'  => '友情链接网址不能为空',
        'url.max'      => '友情链接网址最多不能超过100个字符',
        'type.require' => '友情链接类型不能为空',
    //  'type.in'      => '友情链接类型必须为普通或者推荐友情链接',   
    ];
    
    protected $scene = [
        'edit' => ['name'=>'require|max:60','desc' =>'require|max:150','url' =>'require|max:100','type' =>'require|in:0,1'],
    ];
}
